"use strict";

(function() {
	// LinkJuggernaut.FireFoxExtension
	alx.lj.ffe = {
		instances: [],
		
		init: function (aEvent) {
			var appcontent = document.getElementById("appcontent");
			
			if (appcontent) {
				appcontent.addEventListener("DOMContentLoaded", alx.lj.ffe.onPageLoad, true);
			}	
		},
		
		onPageLoad: function (e) {
			if (!(e.originalTarget instanceof HTMLDocument))
				return;
			
			var document = e.originalTarget;
			
			var lj = new alx.lj.LinkJuggernaut(document);
			alx.lj.ffe.instances.push(lj);
			
			document.defaultView.addEventListener("unload", alx.lj.ffe.onPageUnload, true);
		},
		
		onPageUnload: function (e) {
			if (!(e.originalTarget instanceof HTMLDocument))
				return;
			
			var document = e.originalTarget;
			
		}
	};
})();

window.addEventListener("load", alx.lj.ffe.init, false);